package com.project.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.LogBean;
import com.project.service.LogService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.time.LocalDate;

@Controller
@RequestMapping("log")
public class LogController {

    @Resource
    private LogService logService;


    //展示所有的日志
    @RequestMapping("/findAllLog")
    @ResponseBody
    public IPage<LogBean> findAllLog(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
                                     @RequestParam(value = "pageSize", defaultValue = "3") int pageSize) {
        return logService.findAllLog(pageNo, pageSize);
    }


    //模糊查询
    @RequestMapping("/findTime")
    @ResponseBody
    public IPage<LogBean> findTime(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
                                   @RequestParam(value = "pageSize", defaultValue = "3") int pageSize,
                                   LocalDate startTime, LocalDate endTime) {
        return logService.findTime(pageNo, pageSize, startTime, endTime);
    }
}
